package org.pan.test.ws.service.impl;

import java.util.LinkedList;
import java.util.List;

import javax.jws.WebService;
import javax.ws.rs.GET;
import javax.ws.rs.Path;

import org.pan.test.model.User;
import org.pan.test.ws.service.HelloService;

@WebService
public class HelloServiceImpl implements HelloService {
	
	@Override
	public String sayHi(String text) {
		System.out.println("sayHi called...");
		return "Hi :" + text;
	}

	@GET
	@Path(value="/test")
	@Override
	public String getUser(User user) {
		System.out.println("sayUser called...");
		return "User:[id=" + user.getId() + "][name=" + user.getName() + "]";
	}

	@Override
	public List<User> getList() {
		List<User> list = new LinkedList<User>();
		for(int i=0;i<5;i++){
			User user = new User();
			user.setId(i);
			user.setAge(18+i);
			user.setName("test"+i);
			list.add(user);
		}
		return list;
	}

}